<div class="page-container" v-cloak>
    <el-card>
        <template #header>
            <div class="breadcrumb">
                <el-breadcrumb separator="/">
                    <el-breadcrumb-item>列表示例</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
        </template>
        <div>
            <el-form :inline="true">
                <el-form-item>
                    <el-input v-model="where.user" clearable placeholder="审批人"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-select v-model="where.region" placeholder="活动区域">
                        <el-option label="区域一" value="shanghai"></el-option>
                        <el-option label="区域二" value="beijing"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="searchEvent">查询</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div>
            <el-table
                    :data="data_list"
                    style="width: 100%">
                <el-table-column
                        fixed
                        prop="date"
                        label="日期"
                        min-width="180">
                </el-table-column>
                <el-table-column
                        prop="name"
                        label="姓名"
                        min-width="180">
                </el-table-column>
                <el-table-column
                        prop="address"
                        min-width="380"
                        label="地址">
                </el-table-column>
                <el-table-column
                        prop="record"
                        min-width="80"
                        label="记录">
                    <template #default="{row}">
                        <el-link :underline="false" @click="show_dialog=true" type="primary">
                            {{row.record}}
                        </el-link>
                    </template>
                </el-table-column>
                <el-table-column
                        fixed="right"
                        align="center"
                        min-width="180"
                        label="操作">
                    <template #default="{row}">
                        <el-link>
                            <el-button type="primary">编辑</el-button>
                        </el-link>
                        <el-link @click="deleteEvent(row)">
                            <el-button type="danger">删除</el-button>
                        </el-link>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-container">
                <el-pagination
                        background
                        layout="prev, pager, next, total"
                        :total="total_num"
                        :current-page="current_page"
                        :page-size="per_page"
                        @current-change="currentChangeEvent"
                >
                </el-pagination>
            </div>
        </div>
    </el-card>
    <dialog-lists v-model:show="show_dialog" @close="show_dialog=false"></dialog-lists>
</div>
{hcmstag:include file="demo@/components/dialog-lists"}
<script>
    const App = {
        data() {
            return {
                show_dialog: false,
                is_init_list: true,
                where: {},
            }
        },
        methods: {
            GetList() {
                this.handRes({
                    current_page: 1,
                    last_page: 2,
                    total: 25,
                    data: [{
                        date: '2016-05-02',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1518 弄',
                        record: 20,
                    }, {
                        date: '2016-05-04',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1517 弄',
                        record: 20,
                    }, {
                        date: '2016-05-01',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1519 弄',
                        record: 20,
                    }, {
                        date: '2016-05-03',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1516 弄',
                        record: 20,
                    }]
                })
                // this.httpGet('{:url("admin/access/index/lists")}', {
                //     page: this.current_page,
                //     ...this.where
                // }).then(res => {
                //     let {lists = {}} = res.data
                //     this.handRes(lists)
                // })
            },
            deleteEvent({setting_id}) {
                this.$confirm("是否确认删除该记录？", '提示').then(() => {
                    // this.httpDelete("{:url('admin/setting/delete')}/" + setting_id).then(res => {
                    //     if (res.status) {
                    //         this.$message.success(res.msg)
                    //         this.GetList()
                    //     }
                    // })
                }).catch(err => {
                })
            },
            searchEvent() {
                this.refreshList()
            }
        }
    }
</script>